<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>资金明细列表</title>
    <c:set var="allFundFinancialType"
           value="%{@com.mrd.gtimp.v2.fund.FundFinancialTypeEnum@ALL_OPTION()}"/>
    <c:set var="allFundIEType" value="%{@com.mrd.gtimp.v2.fund.FundIETypeEnum@ALL_SUP_OPTION()}"/>
</head>
<script type="text/javascript">
    var allFundFinancialType = "${allFundFinancialType}";
    var allFundIEType = "${allFundIEType}";
    var balance = "${balance}";
    var formSetting = {
        title: "资金流水",
        module: 'query',
        numCount: '3',
        columns: [{
            index: "BILLNO",
            name: "billNo",
            label: "业务编号"
        }, {
            index: "financialType",
            name: "financialType",
            type: "dropdown",
            data: allFundFinancialType,
            label: "入账类型",
            op: "eq"
        }, {
            index: "ietype",
            name: "ietype",
            type: "dropdown",
            data: allFundIEType,
            label: "账务类型",
            op: "eq"
        }, {
            index: "REGDATE",
            name: "regDate",
            type: "date",
            label: "入账时间起",
            op: "ge"
        }, {
            index: "REGDATE",
            name: "regDate",
            label: "入账时间止",
            type: "date",
            op: "le"
        }],
        buttons: {
            custom: [{
                id: "reportBtn",
                value: "查看报表",
                click: function () {
                    window.location.href = "report-main";
                }
            }]
        },
        grid: {
            id: "dataGrid",
            title: "资金明细列表：账户余额（元）￥${balance}",
            url: "flow-findSupList",
            colModel: [{
                index: "id",
                name: "id",
                label: "id",
                hidden: true
            }, {
                index: "billno",
                name: "billNo",
                label: "业务编号"
            }, {
                index: "financialType",
                name: "financialType",
                label: "收支类型"
            }, {
                index: "ietype",
                name: "ietype",
                label: "账务类型"
            }, {
                index: "amount",
                name: "amount",
                label: "入账金额(元)"
            }, {
                index: "balance",
                name: "balance",
                label: "账户结余(元)"
            }, {
                index: "regDate",
                name: "regDate",
                formatter: 'date',
                formatoptions: {
                    srcformat: 'Y-m-d H:i:s',
                    newformat: 'Y-m-d H:i:s'
                },
                label: "入账时间"
            }],
            sortname: "regDate",
            sortorder: "desc",
            jsonReader: {
                root: "datas"
            },
            loadComplete: function (data) {
                $("td[aria-describedby='dataGrid_financialType']").each(function () {
                    $(this).text(stateUtil.get(allFundFinancialType, $(this).text()));
                });
                $("td[aria-describedby='dataGrid_ietype']").each(function () {
                    $(this).text(stateUtil.get(allFundIEType, $(this).text()));
                });
            }
        }
    };
    $(document).ready(function () {
        $("#dataTable").mrdForm(formSetting);
    });
    var stateUtil = {
        get: function (arras, key) {
            for (var a in arras) {
                if (arras[a][1] == key) {
                    return arras[a][0];
                }
            }
        }
    }
</script>
<body>
<div id="dataTable"></div>
</body>
</html>
